﻿

namespace hpl
{

Node::Node(const int type, Node* parent): type(type), parent(parent), wasFilled(false), tokenAbandoned(false)
{
}

Node::~Node()
{
	for(std::vector<Node*>::iterator it = children.begin(); it != children.end(); it++)
	{
		delete *it;
	}
}

int Node::GetType()
{
	return type;
}

Node* Node::GetParent()
{
	return parent;
}

size_t Node::GetChildrenCount()
{
	return children.size();
}

Node* Node::GetChild(const size_t index)
{
	if(index >= children.size())
	{
		return NULL;
	}
	return children[index];
}

void Node::AddChild(Node* node)
{
	children.push_back(node);
}

bool Node::WasFilled() const
{
	return wasFilled;
}

bool Node::TokenAbandoned() const
{
	return tokenAbandoned;
}

}//namespace hpl

